home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2000 September / maximum-cd-2000-09.iso / Vampire the Masquerade / vampire_demo.exe / Codex.nob / MultiDoor.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-06-22  |  3.5 KB  |  190 lines

  1. public class MultiDoor extends Codex {
  2.    private CodexThing _door = new CodexThing(((Codex)this).GetClassThing());
  3.    private float _speed = 10.0F;
  4.    private CodexThing _door2;
  5.    private CodexThing _door3;
  6.    private CodexThing _door4;
  7.    private CodexThing _door5;
  8.    private CodexThing _door6;
  9.    private CodexThing _door7;
  10.    private CodexThing _door8;
  11.    private int _OpenOnce;
  12.    private boolean bOpen;
  13.    private boolean bActive;
  14.    public static String[] _params = new String[]{"Movement speed;10.0", "Open Once;0", "Second part of door", "Third part of door", "Fourth part of door", "Fifth part of door", "Sixth part of door", "Seventh part of door", "Eighth part of door"};
  15.  
  16.    public void clicked(int guid, int clickerGuid, int captureId) {
  17.       if (!this.bActive) {
  18.          this.bActive = true;
  19.          if (!this.bOpen) {
  20.             this._door.MoveToFrame(1, this._speed);
  21.             if (this._door2 != null) {
  22.                this._door2.MoveToFrame(1, this._speed);
  23.             }
  24.  
  25.             if (this._door3 != null) {
  26.                this._door3.MoveToFrame(1, this._speed);
  27.             }
  28.  
  29.             if (this._door4 != null) {
  30.                this._door4.MoveToFrame(1, this._speed);
  31.             }
  32.  
  33.             if (this._door5 != null) {
  34.                this._door5.MoveToFrame(1, this._speed);
  35.             }
  36.  
  37.             if (this._door6 != null) {
  38.                this._door6.MoveToFrame(1, this._speed);
  39.             }
  40.  
  41.             if (this._door7 != null) {
  42.                this._door7.MoveToFrame(1, this._speed);
  43.             }
  44.  
  45.             if (this._door8 != null) {
  46.                this._door8.MoveToFrame(1, this._speed);
  47.             }
  48.  
  49.             this.bOpen = true;
  50.          } else {
  51.             this._door.MoveToFrame(0, this._speed);
  52.             if (this._door2 != null) {
  53.                this._door2.MoveToFrame(0, this._speed);
  54.             }
  55.  
  56.             if (this._door3 != null) {
  57.                this._door3.MoveToFrame(0, this._speed);
  58.             }
  59.  
  60.             if (this._door4 != null) {
  61.                this._door4.MoveToFrame(0, this._speed);
  62.             }
  63.  
  64.             if (this._door5 != null) {
  65.                this._door5.MoveToFrame(0, this._speed);
  66.             }
  67.  
  68.             if (this._door6 != null) {
  69.                this._door6.MoveToFrame(0, this._speed);
  70.             }
  71.  
  72.             if (this._door7 != null) {
  73.                this._door7.MoveToFrame(0, this._speed);
  74.             }
  75.  
  76.             if (this._door8 != null) {
  77.                this._door8.MoveToFrame(0, this._speed);
  78.             }
  79.  
  80.             this.bOpen = false;
  81.          }
  82.  
  83.       }
  84.    }
  85.  
  86.    public void beginscene(int clientGuid, int captureID) {
  87.       this._door.SetThingFlags(8192);
  88.       this._door2.SetThingFlags(8192);
  89.       this._door3.SetThingFlags(8192);
  90.       this._door4.SetThingFlags(8192);
  91.       this._door5.SetThingFlags(8192);
  92.       this._door6.SetThingFlags(8192);
  93.       this._door7.SetThingFlags(8192);
  94.       this._door8.SetThingFlags(8192);
  95.    }
  96.  
  97.    public void arrived(int thingGuid, int frameNum, int captureId) {
  98.       if (this._OpenOnce == 0) {
  99.          this.bActive = false;
  100.       } else if (this._OpenOnce == 1) {
  101.          this._door.SetThingFlags(64);
  102.          this._door2.SetThingFlags(64);
  103.          this._door3.SetThingFlags(64);
  104.          this._door4.SetThingFlags(64);
  105.          this._door5.SetThingFlags(64);
  106.          this._door6.SetThingFlags(64);
  107.          this._door7.SetThingFlags(64);
  108.          this._door8.SetThingFlags(64);
  109.       }
  110.  
  111.    }
  112.  
  113.    public void restore(int flags) {
  114.       this.bOpen = CodexSequence.RestoreBoolean();
  115.    }
  116.  
  117.    public void save(int flags) {
  118.       CodexSequence.SaveBoolean(this.bOpen);
  119.    }
  120.  
  121.    public MultiDoor(float speed, int OpenOnce, CodexThing door2, CodexThing door3, CodexThing door4, CodexThing door5, CodexThing door6, CodexThing door7, CodexThing door8) {
  122.       this._door.SetDescriptionID("GEN_DOOR");
  123.       this._speed = speed;
  124.       this._OpenOnce = OpenOnce;
  125.       if (door2 != null) {
  126.          this._door2 = new CodexThing(((Codex)door2).GetGUID());
  127.          if (this._door2.GetDescriptionID().equalsIgnoreCase("PROP")) {
  128.             this._door2.SetDescriptionID("GEN_DOOR");
  129.          }
  130.  
  131.          ((Codex)this).CaptureThing(this._door2.GetGUID());
  132.       }
  133.  
  134.       if (door3 != null) {
  135.          this._door3 = new CodexThing(((Codex)door3).GetGUID());
  136.          if (this._door3.GetDescriptionID().equalsIgnoreCase("PROP")) {
  137.             this._door3.SetDescriptionID("GEN_DOOR");
  138.          }
  139.  
  140.          ((Codex)this).CaptureThing(this._door3.GetGUID());
  141.       }
  142.  
  143.       if (door4 != null) {
  144.          this._door4 = new CodexThing(((Codex)door4).GetGUID());
  145.          if (this._door4.GetDescriptionID().equalsIgnoreCase("PROP")) {
  146.             this._door4.SetDescriptionID("GEN_DOOR");
  147.          }
  148.  
  149.          ((Codex)this).CaptureThing(this._door4.GetGUID());
  150.       }
  151.  
  152.       if (door5 != null) {
  153.          this._door5 = new CodexThing(((Codex)door5).GetGUID());
  154.          if (this._door5.GetDescriptionID().equalsIgnoreCase("PROP")) {
  155.             this._door5.SetDescriptionID("GEN_DOOR");
  156.          }
  157.  
  158.          ((Codex)this).CaptureThing(this._door5.GetGUID());
  159.       }
  160.  
  161.       if (door6 != null) {
  162.          this._door6 = new CodexThing(((Codex)door6).GetGUID());
  163.          if (this._door6.GetDescriptionID().equalsIgnoreCase("PROP")) {
  164.             this._door6.SetDescriptionID("GEN_DOOR");
  165.          }
  166.  
  167.          ((Codex)this).CaptureThing(this._door6.GetGUID());
  168.       }
  169.  
  170.       if (door7 != null) {
  171.          this._door7 = new CodexThing(((Codex)door7).GetGUID());
  172.          if (this._door7.GetDescriptionID().equalsIgnoreCase("PROP")) {
  173.             this._door7.SetDescriptionID("GEN_DOOR");
  174.          }
  175.  
  176.          ((Codex)this).CaptureThing(this._door7.GetGUID());
  177.       }
  178.  
  179.       if (door8 != null) {
  180.          this._door8 = new CodexThing(((Codex)door8).GetGUID());
  181.          if (this._door8.GetDescriptionID().equalsIgnoreCase("PROP")) {
  182.             this._door8.SetDescriptionID("GEN_DOOR");
  183.          }
  184.  
  185.          ((Codex)this).CaptureThing(this._door8.GetGUID());
  186.       }
  187.  
  188.    }
  189. }
  190.